package ass.web;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import ass.beans.UserBean;
import ass.dao.UserDAO;
import ass.dao.support.UserDAOImpl;

/**
 * Servlet implementation class BrowseTicketServlet
 */
public class BrowseTicketServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public BrowseTicketServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession(true);
		String username = (String) session.getAttribute("username");
		
//		String title = (String) request.getParameter("title");
//		String cinema = (String) request.getParameter("cinema");
//		String time = (String) request.getParameter("time");
//		String amount = (String) request.getParameter("amount");
//		
//		
		System.out.println(username);

		
		UserDAOImpl userDAO = new UserDAOImpl();
		UserBean userbean = userDAO.getUser(username);

		String nextJSP = "/userTicket.jsp";
		RequestDispatcher dispatcher = getServletContext()
				.getRequestDispatcher(nextJSP);
		request.setAttribute("userbean", userbean);
		dispatcher.forward(request, response);
		
		

	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
